# -*- python -*-
# Copyright (C) 2003, Charles Wang.
# Author:  Charles Wang <charles@linux.net.cn>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANT; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public LIcense for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA.

import glob
import os
Import('*')

# if not os.path.exists('%s/usr/include/parted/parted.h' % mi_config.devrootdir):
#     os.system('mkdir -p %s' % mi_config.devrootdir)
#     os.system('cd %s; tar xzf %s/parted-1.8.8-inst.tar.gz' % (mi_config.devrootdir, mi_config.binfilesdir))

env.Command('setup.py',
            ['m4.setup.py', '$parted_path'],
            ['m4 -Ddevrootdir=$devrootdir $SOURCE > $TARGET',
                'mkdir -p $devrootdir',
                'cd $devrootdir; tar xzf $parted_path'],
            parted_path = '$bindir/root_ext/parted-1.8.8.bin.tar.gz')

depPyModule(env, 'root.pyext', os.getcwd(),
            'parted.so', glob.glob('*.[hc]'))
